package cn.tedu.yl.parentd_department.controller;

import cn.tedu.yl.base.response.JsonResult;
import cn.tedu.yl.parentd_department.pojo.dto.ParentdDepartmentQuery;
import cn.tedu.yl.parentd_department.pojo.dto.ParentdDepartmentSaveParam;
import cn.tedu.yl.parentd_department.pojo.vo.ParentdDepartmentVO;
import cn.tedu.yl.parentd_department.service.ParentdDepartmentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/v1/parentddepartment")
public class ParentdDepartmentController {

    @Autowired
    private ParentdDepartmentService parentdDepartmentService;

    @GetMapping("select")
    public JsonResult select(ParentdDepartmentQuery parentdDepartmentQuery){
        List<ParentdDepartmentVO> list = parentdDepartmentService.select(parentdDepartmentQuery);
        return JsonResult.ok(list);
    }

    @PostMapping("save")
    public JsonResult save(ParentdDepartmentSaveParam parentdDepartmentSaveParam ){
        parentdDepartmentService.save(parentdDepartmentSaveParam);
        return JsonResult.ok();
    }

}
